package com.shujia.three;


import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;

public class QueueDemo {

    /*
    queue队列, 先进先出
     */
    public static void main(String[] args) {
        Queue queue = new ArrayBlockingQueue(3);

        queue.offer(1);
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);


        // 从队列取数据, 并移除
        Object poll = queue.poll();
        System.out.println(poll);
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());

    }
}
